
VPATH=.

CC=gcc
CXX=g++
#CFLAGS=-Wall -g -O2 -D_DEBUG -Iinclude/
CFLAGS=-Wall -g -O2  -Iinclude/
LDFLAGS=-L./lib
DEPLIBS= -lv8 -lcurl -lrtmp -lssh2 -lssl -lcrypto -lidn -lldap -lrt -lz -ldl -lpthread -luuid

TARGET=ku6downloader

all:$(TARGET)

OBJS=JSDownloader_New.o block_queue.o hash.o thread_pool.o mem_pool.o

$(TARGET):$(TARGET)_g
	cp $< $@
	strip $@

$(TARGET)_g:$(OBJS) 
	$(CXX) -o $@ $(OBJS) $(LDFLAGS) $(DEPLIBS)

%.o:%.c
	$(CC) $(CFLAGS) -c $< -o $@

%.o:%.cpp
	$(CXX) $(CFLAGS) -c $< -o $@

# dummy rule
%.h:
	@:

JSDownloader_New.o:JSDownloader_New.cpp circlequeue_shm.h block_queque.h mem_pool.h hash.h

block_queue.o: block_queue.c block_queue.h

hash.o:hash.c hash.h

mem_pool.o: mem_pool.c mem_pool.h

distclean:clean

clean:
	rm -f *.o $(TARGET) $(TARGET)_g

.PHONY: all clean
